<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>拖放</title>
    <style>
        #div1{
            width: 198px;
            height: 66px;
            padding: 10px;
            border: 1px solid red;
        }
    </style>
    <script type="text/javascript">
        function allowDrop(ev)
        {
            ev.preventDefault();
        }
        function drag(ev)
        {
            ev.dataTransfer.setData("Text",ev.target.id);
        }

        function drop(ev)
        {
            ev.preventDefault();
            var data=ev.dataTransfer.getData("Text");
            ev.target.appendChild(document.getElementById(data));
        }
    </script>
</head>

<body>

<div id="div1" ondrop="(event)" ondragover="allowDrop(event)">
</div>
<img id="drag1" src="img/23.png" draggable="true"
ondragstart="drag(event)" />

</body>

</html>